package com.zhongcw.test.spring.boot.validation.controller;

import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * @author ZCW
 * @createTime 2018/4/12
 * @lastUpdateTime 2018/4/12 ZCW
 */
@RestController
public class ValidController {

    @GetMapping("/user")
    public String user(@NotEmpty(message = "{user.name.notBlank}") String name, @Size(max = 300, min = 18, message ="{user.age.size}") Integer age) {
        return name + "  " + age;
    }

    @GetMapping
    public String test(@NotNull String name) {
        return name;
    }
}
